//
//  YBClassBasicInfoTableViewCell.m
//  ZhongWangYuanApp
//
//  Created by apple on 2019/4/26.
//  Copyright © 2019 apple. All rights reserved.
//

#import "YBClassBasicInfoTableViewCell.h"

@interface YBClassBasicInfoTableViewCell ()

@property (nonatomic , strong) UILabel * cellTitleLabel;

@property (nonatomic , strong) UILabel * infoLabel;

@property (nonatomic , assign) CGFloat itemHeight;

@end

@implementation YBClassBasicInfoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.itemHeight = [@"尚锟" boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : LYPFONT(16)} context:nil].size.height + 1;
        [self initMyCell];
    }
    return self;
}

-(void)initMyCell
{
    [self.contentView addSubview:self.cellTitleLabel];
    [self.contentView addSubview:self.infoLabel];
    self.cellTitleLabel.sd_layout
    .leftSpaceToView(self.contentView, 0)
    .topSpaceToView(self.contentView, ItemHeight * 15)
    .widthIs(ItemWidth * 250)
    .heightIs(self.itemHeight);
    
    self.infoLabel.sd_layout
    .leftSpaceToView(self.cellTitleLabel, 0)
    .rightSpaceToView(self.contentView, ItemWidth * 30)
    .topSpaceToView(self.contentView, ItemHeight * 15)
    .bottomSpaceToView(self.contentView, ItemHeight * 15);
    
    [ToolClass addUnderLineWithSuperView:self.contentView leftSpace:0 rightSpace:0];
}

-(void)setCellInfoWithTitle:(NSString *)title infoString:(NSString *)infoString
{
    self.cellTitleLabel.text = title;
    self.infoLabel.text = infoString;
}

-(UILabel *)cellTitleLabel
{
    if (!_cellTitleLabel) {
        _cellTitleLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@""];
        _cellTitleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _cellTitleLabel;
}

-(UILabel *)infoLabel
{
    if (!_infoLabel) {
        _infoLabel = [ToolClass creatLabelWithFrame:CGRectMake(0, 0, 1, 1) font:16 textColor:[UIColor textGrayColor] text:@""];
    }
    return _infoLabel;
}

@end
